home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / mmailp.idb / usr / lib / Zmail / bin / sh-versions / audiosend.z / audiosend
Encoding:
Text File  |  1997-01-22  |  3.3 KB  |  129 lines

  1. :
  2. # Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
  3. # Permission to use, copy, modify, and distribute this material 
  4. # for any purpose and without fee is hereby granted, provided 
  5. # that the above copyright notice and this permission notice 
  6. # appear in all copies, and that the name of Bellcore not be 
  7. # used in advertising or publicity pertaining to this 
  8. # material without the specific, prior written permission 
  9. # of an authorized representative of Bellcore.  BELLCORE 
  10. # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
  11. # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
  12. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  13.  
  14. # Conversion from C shell to Bourne shell by Z-Code Software Corp.
  15. # Conversion Copyright (c) 1992 Z-Code Software Corp.
  16. # Permission to use, copy, modify, and distribute this material
  17. # for any purpose and without fee is hereby granted, provided
  18. # that the above copyright notice and this permission notice
  19. # appear in all copies, and that the name of Z-Code Software not
  20. # be used in advertising or publicity pertaining to this
  21. # material without the specific, prior written permission
  22. # of an authorized representative of Z-Code.  Z-CODE SOFTWARE
  23. # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
  24. # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS",
  25. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  26.  
  27. # Brought into line with metamail 2.7 beta release Csh version
  28. #    Dave Shield    February 1994
  29.  
  30. if test ! -z "${METAMAIL_TMPDIR:-}"
  31. then
  32.         METAMAIL_TMPDIR=/tmp
  33. fi
  34.  
  35. # This is to make metamail/showaudio do playback on the speaker, not the phone.
  36. AUDIOSPEAKERFORCE=1 ; export AUDIOSPEAKERFORCE
  37.  
  38. if test -d /usr/sony
  39. then
  40.     dev=/dev/sb0
  41. else
  42.     dev=/dev/audio
  43. fi
  44.  
  45. if test -f /usr/lib/sendmail
  46. then
  47.     MAILCOMMAND=/usr/lib/sendmail
  48. else
  49.     MAILCOMMAND=/bin/mail
  50. fi
  51.  
  52. if test ! -z "${1:-}"
  53.     to=$1
  54. else
  55.     echo-n "To: "
  56.     read to
  57. fi
  58. echo-n "Subject: "
  59. read subject
  60. echo-n "CC: "
  61. read cc
  62.  
  63. record=1
  64.  
  65. while true
  66. do
  67.     if test $record -eq 1
  68.     then
  69.         echo-n "Press RETURN when you are ready to start recording: "
  70.         read foo
  71.  
  72.         fname=${METAMAIL_TMPDIR}/audio-out.$$
  73.         fnameraw=${METAMAIL_TMPDIR}/audio-raw.$$
  74.  
  75.         echo "To: $to" > $fname
  76.         echo "Subject: $subject" >> $fname
  77.         echo "CC: $cc" >> $fname
  78.         echo "MIME-Version: 1.0" >> $fname
  79.         echo "Content-Type: audio/basic" >> $fname
  80.         echo "Content-Transfer-Encoding: base64" >> $fname
  81.         echo "" >> $fname
  82.  
  83.         trap "kill -9 $! > /dev/null 2>&1" 1 2 15
  84.  
  85.         if test -z "RECORD_AUDIO"
  86.         then
  87.             (/bin/cat < $dev > $fnameraw) &
  88.         else
  89.             ($RECORD_AUDIO > $fnameraw) &
  90.         fi
  91.         echo-n "press RETURN when you are done recording: "
  92.         read foo
  93.         echo One moment please...
  94.         /bin/sleep 1
  95.         echo-n Killing recording job...
  96.         /bin/kill -9 $! > /dev/null 2>&1
  97.         mimencode -b < $fnameraw >> $fname
  98.         /bin/rm $fnameraw
  99.         echo "" >> $fname
  100.     fi
  101.     record=0
  102.  
  103.     echo ""
  104.     echo "What do you want to do?"
  105.     echo ""
  106.     echo "1 -- Send mail"
  107.     echo "2 -- Listen to recorded message"
  108.     echo "3 -- Replace with a new recording"
  109.     echo "4 -- Quit"
  110.     read which
  111.     case $which in
  112.         1) echo-n "Sending mail, please wait...  "
  113.           $MAILCOMMAND $to $cc < $fname
  114.  
  115.           if test $? -eq 0
  116.           then
  117.             echo Done.
  118.             /bin/rm -f $fname
  119.             exit 0
  120.           else
  121.             echo Mail delivery failed, draft is in $fname
  122.           fi ;;
  123.         2) metamail -d $fname ;;
  124.         3) record=1 ;;
  125.         4) exit 0 ;;
  126.     esac
  127. done
  128.